<%@page contentType="application/vnd.ms-excel" %>
<%

	response.setHeader("Content-Disposition","attachment;filename=iwanalysis.xls");

	String strHeaders 	= request.getParameter("hidTableHeaders");
	String strData 		= request.getParameter("hidExcelData");

	String[] tableHeaders = strHeaders.split(",");
	String[] tableData	  = strData.split("\\|");
%>

<table border="1">
	<tr>
		<th align="center" style='background-color:yellow;'>Sector</th>
		<th align="center" style='background-color:yellow;'>Ratio</th>
		<th align="center" style='background-color:yellow;'>Firms</th>
		<%
			for(int i=0;i<tableHeaders.length;i++){
				out.println("<th align='center' style='background-color:yellow;'>" + tableHeaders[i] + "</th>");
			}
		%>
	</tr>
	<%
		for(int i=0;i<tableData.length;i++){
			out.println("<tr>");
			String[] rowData = tableData[i].split("\\+");
			for(int j=0;j<rowData.length;j++){
				out.println("<td>" + rowData[j] + "</td>");
			}
			out.println("</tr>");
			// limit the number of rows to 25 only.
			if(i == 24)break;
		}
	%>
</table>